package test.db.mysql.table;

public enum ItemTable implements Table {
    SID(Column.sid),
    CONTENT(Column.question),
    SEQ(Column.seq),
    ANSWER_YN(Column.answerYn),
    DISPLAY_CODE(Column.displayCode),
    QUESTION_SID(Column.questionSid),
    USE_YN(Column.useYn);
    
    private final Column column;
    private static final String TYPE_SID = "VARCHAR(20)";
    private static final String TYPE_CONTENT = "TEXT";
    private static final String TYPE_SEQ = "INT(2)";
    private static final String TYPE_ANSWER_YN = "VARCHAR(1)";
    private static final String TYPE_DISPLAY_CODE = "VARCHAR(12)";
    private static final String TYPE_QUESTION_SID = "VARCHAR(20)";
    private static final String TYPE_USE_YN = "VARCHAR(1)";

    ItemTable(Column column) {
        this.column = column;
    }
    
    private enum Column {
        sid {
            String getType() {
                return TYPE_SID;
            }
        },
        
        question {
            String getType() {
                return TYPE_CONTENT;
            }
        },
        
        seq {
            String getType() {
                return TYPE_SEQ;
            }
        },
        
        answerYn {
            String getType() {
                return TYPE_ANSWER_YN;
            }
        },
        
        displayCode {
            String getType() {
                return TYPE_DISPLAY_CODE;
            }
        },
        
        questionSid {
            String getType() {
                return TYPE_QUESTION_SID;
            }
        },
        
        useYn {
            String getType() {
                return TYPE_USE_YN;
            }
        };
        
        abstract String getType();
    }
    
    public String getType() {
        return column.getType();
    }
    
    public void initData() throws Exception {
        System.out.println("CALL NOW");
    }
}